package com.team.utils.util_wx.service;

import com.team.utils.util_wx.common.Configure;
import com.team.utils.util_wx.common.XMLParser;
import com.team.utils.util_wx.protocol.refund_query_protocol.RefundQueryReqData;
import com.team.utils.util_wx.protocol.refund_query_protocol.RefundQueryResData;

public class RefundQueryService extends BaseService {

	public RefundQueryService() throws IllegalAccessException, InstantiationException, ClassNotFoundException {
		super(Configure.REFUND_QUERY_API);
	}

	/**
	 * 请求退款查询服务
	 * 
	 * @param refundQueryReqData
	 *            这个数据对象里面包含了API要求提交的各种数据字段
	 * @return API返回的XML数据
	 * @throws Exception
	 */
	public String request(RefundQueryReqData refundQueryReqData) throws Exception {

		// 发送HTTPS的Post请求到API地址
		String responseString = sendPost(refundQueryReqData);

		return responseString;
	}

	public RefundQueryResData refundQuery(RefundQueryReqData refundQueryReqData) throws Exception {
		return (RefundQueryResData) XMLParser.getObjectFromXML(request(refundQueryReqData), RefundQueryResData.class);
	}
}
